#include <pc.h>

#include "timer.h"

void timer_init(int timer, int mode){
	outportb(TIMER_CTRL, (timer << 6) | mode);
	if(timer == 2){
		char val = inportb(SPEAKER_CTRL);
		outportb(SPEAKER_CTRL, val | TIMER2_ENABLE);
	}
}

void timer_load(int timer, int value){
	outportb(TIMER_0 | timer, LSB(value));
	outportb(TIMER_0 | timer, MSB(value));
}
